package com.qiang.demo02;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Test03 {
    public static void main(String[] args) {
        TreeMap<String, Integer> sss = new TreeMap<>();
        sss.put("张三", 21);
        sss.put("李四", 20);
        sss.put("王五", 23);
        sss.put("赵六", 17);
        sss.put("谭七", 22);
        /*System.out.println(sss);
        sss.put("杨八",78);
        System.out.println(sss);
        Integer it = sss.remove("张三");
        System.out.println(it);
        System.out.println(sss);
        boolean empty = sss.isEmpty();
        System.out.println(empty);
        //sss.clear();
        System.out.println(sss);
        System.out.println(sss.isEmpty());*/

        Set<Map.Entry<String, Integer>> entries = sss.entrySet();
        for (Map.Entry<String, Integer> entry : entries) {
            String key = entry.getKey();
            Integer value = entry.getValue();
            System.out.println(key + "===" + value);


        }


        TreeMap<String, String> ssss = new TreeMap<>();
        ssss.put("张三", "21");
        ssss.put("李四", "20");
        ssss.put("王五", "23");
        ssss.put("赵六", "17");
        ssss.put("谭七", "22");
        /*String ss = ssss.put("王五", "99");
        System.out.println(ss);
        System.out.println(ssss);
        int size = ssss.size();
        System.out.println(size);*/

        Set<String> keyset = ssss.keySet();
        for (String s : keyset) {
            String s1 = ssss.get(s);
            System.out.println(s + "///" + s1);
        }

        HashMap<String, String> str = new HashMap<>();
    }
}
